var RoleAddPage = {
	'validate':function() {
		var $frm = $("#roleAddFrm");
		
		var roleNameValidateChain = [
		    {'validateFunc':'StringUtil.lengthLessThan', 'errorText':'角色名称过长，允许的最大长度为64个字符','params':[64]}
		];
		if (!$frm.find("input[name='roleName']").simpleValidate("角色名称不能为空", roleNameValidateChain)) {
			return false;
		}
		var roleCodeValidateChain = [
            {'validateFunc':'StringUtil.lengthLessThan', 'errorText':'角色编码过长，允许的最大长度为32个字符','params':[32]},
            {'validateFunc':'ValidateUtil.validate', 'errorText':'角色编码可由英文字母数字或下划线组成，长度在32个字符以内','params':['^[A-Za-z_$]+[A-Za-z_$\\d]+$']},
        ];
		if (!$frm.find("input[name='roleCode']").simpleValidate("角色编码不能为空", roleCodeValidateChain)) {
			return false;
		}
		return true;
	},
	'saveRole':function() {
		if (RoleAddPage.validate()) {
			addRoleAjax.send();
		}
	},
	'saveRoleSucc':function(data, xhr, status) {
		MsgBox.info(data.message, null, function() {
			var mWindow = MsgBox.getCurrentOpenDialogWindow();
			mWindow.roleDatatable.refresh();
			MsgBox.closeActiveDialog();
		});
	}
};